<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html">

    <body>

        <ui:composition template="./main_template.xhtml">
            
            <ui:define name="title_option">
                <h:outputText value="Mantenimiento general de menu"/>
            </ui:define>

            <ui:define name="main">
                <p:tree id="tree" value="#{treeMenuBean.root}" var="m" selectionMode="single" selection="#{treeMenuBean.selected}">
                    <p:treeNode type="item" icon="ui-icon-document">
                        <h:outputText value="#{m.descripcion}"/>
                    </p:treeNode>
                    <p:treeNode type="sub_menu">
                        <h:outputText value="#{m.descripcion}"/>
                    </p:treeNode>
                </p:tree>
                
                <p:contextMenu for="tree">
                    <p:menuitem value="Agregar Item" update="tree" icon="ui-icon-circle-plus" />
                    <p:menuitem value="Agregar Sub Menu" update="tree" icon="ui-icon-circle-arrow-e"/>
                    <p:menuitem value="Editar" update="tree" icon="ui-icon-circle-arrow-e"/>
                    <p:menuitem value="Eliminar" update="tree" icon="ui-icon-circle-arrow-e"/>
                </p:contextMenu>
            </ui:define>

        </ui:composition>

    </body>
</html>
